CC		= arm-elf-gcc
AR		= arm-elf-ar
DUMP	= arm-elf-objdump
SIZE	= arm-elf-size

VMLIB	= vm.a

SOURCES	= j_vars.c j_mem.c j_gc.c j_float.c j_lang.c j_thread.c j_vm.c j_bcode.c
HEADERS	= jvm.h javavm.h jcommon.h jdbg.h

OBJS	= $(SOURCES:.c=.o)
LISTS	= $(SOURCES:.c=.lst)

CFLAGS 	= -c -mcpu=arm7tdmi -mthumb-interwork -mthumb -ansi -Os -I. -fsigned-char -Wall 

%.o: %.c makefile $(HEADERS)
	$(CC) $(CFLAGS) $*.c -o$*.o
#	$(DUMP) -S -w -h $*.o >$*.lst
		 	
$(VMLIB): $(OBJS) makefile
	$(AR) r $@ $(OBJS)
	$(SIZE) -t $(VMLIB)
	
all: $(OBJS) $(HEADERS) makefile
	$(MAKE)

clean:
	rm -f $(VMLIB) $(OBJS) $(LISTS)
		 
